<%@page import="com.wanmait.travel.vo.Pager"%>
<%@page import="com.wanmait.travel.vo.Manager"%>
<%@page import="com.wanmait.travel.vo.Scenic"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%
  String path=request.getServletContext().getContextPath();
  %>
<jsp:include page="/managerinc/header.jsp"></jsp:include>
	<section>
		<h2>景点展示</h2>
		
		<a href="<%=path %>/scenic/my.jsp">我的发布</a>
		<table width="100%" border="1">
		<tr class="listTr">
		<th width="3%">序号</th>
		<th>景点名称</th>
		<th>景点省份</th>
		<th>景点城市</th>
		<th>地址</th>
		<th>开业时间</th>
		<th>闭店时间</th>
		<th>评分</th>
		<th width="5%">景点管理者</th>
		<th>选项</th>
		</tr>
		
	<%
	Manager manager=(Manager)request.getSession().getAttribute("manager");
    Pager pager = (Pager)request.getAttribute("searchShow");
    List<Scenic> scenics=(List<Scenic>)pager.getData();
    for(int i=0;scenics!=null&&i<scenics.size();i++){
    	Scenic scenic=scenics.get(i);
    %>
    	<tr>
		<td><%=i+1 %></td>
		<td><%=scenic.getName() %></td>
		<td><%=scenic.getProvince().getName() %></td>
		<td><%=scenic.getCity().getName() %></td>
		<td><%=scenic.getLocation() %></td>
		<td><%=scenic.getOpenTime() %></td>
		<td><%=scenic.getCloseTime() %></td>
		<td><%=scenic.getAnding() %></td>
		<td><%=scenic.getManager().getName() %></td>
		<td>
		<%
		if(scenic.getManagerId()==manager.getId()) {
			if(scenic.getEnable()==true){
		%>
		<a href="<%=path%>/ScenicController?action=delete&id=<%=scenic.getId() %>">撤回</a>
		<%}else{ %>
		<a href="<%=path%>/ScenicController?action=recover&id=<%=scenic.getId() %>">发布</a>
		<%} %>
		<a href="<%=path%>/ScenicController?action=edit&id=<%=scenic.getId() %>">修改</a>
		<%} %>
		</td>
		</tr>
		<%
		} 
		%>
		</table>
		<div>
		<!-- 上翻页 -->
		<%
		String search=(String)request.getSession().getAttribute("search");
		if(pager.hasPrev()){ 
		%>
		<a href="<%=path%>/ScenicController?action=searchFind&search=<%=search %>&pageNum=<%=pager.getPageNum()-1%>">&lt;&lt;</a>
		<%} %>
		
		
		
		<%
		for(int i=1;i<=pager.getPageCount();i++){
		%>
		<a href="<%=path %>/ScenicController?action=searchFind&search=<%=search %>&pageNum=<%=i %>"  class="<%=pager.getPageNum()==i?"cur":"" %>"><%=i %></a>
		<%} %>	
		
		
		<!-- 下翻页 -->
		<%if(pager.hasNext()){ %>
		<a href="<%=path%>/ScenicController?action=searchFind&search=<%=search %>&pageNum=<%=pager.getPageNum()+1%>">&gt;&gt;</a>
		<%} %>
		</div>
	</section>
<jsp:include page="/managerinc/footer.jsp"></jsp:include>
<script type="text/javascript" src="//js.users.51.la/20136763.js"></script>